//
//  CommonDetailViewController.m
//  DaiShengInvest
//
//  Created by 张睿 on 2017/8/21.
//  Copyright © 2017年 davinci. All rights reserved.
//

#import "CommonDetailViewController.h"

@interface CommonDetailViewController ()

@end

@implementation CommonDetailViewController


- (void)viewWillAppear:(BOOL)animated{
    
    NSDictionary * parameters = @{@"id":self.ID};
    
    [[NetworkTool sharedTools] POST:@"help/detail" parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, NSDictionary *  _Nullable responseObject) {
        
        NSDictionary * param = responseObject[@"param"];
        
        UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
        
        webView.scalesPageToFit = YES;
        
        [webView loadHTMLString:param[@"content"] baseURL:nil];
        
        [self.view addSubview:webView];
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
    }];
    
    
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.edgesForExtendedLayout = UIRectEdgeNone;
    self.title = @"常见问题详情";
    
    UIButton * backButton = [[UIButton alloc] init];
    
    backButton.frame = CGRectMake(15 * SCREENH6, 5 * SCREENH6, 12 * SCREENH6, 20 * SCREENH6);
    [backButton setImage:[UIImage imageNamed:@"1返回"] forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(backToAccountView) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem * leftButton = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    
    self.navigationItem.leftBarButtonItem = leftButton;

}


- (void)backToAccountView{
    
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
